<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html >
<html>
<head>
<title>查看网点区域</title>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=iHmf7QZXEuB0Bxy1MVwEMvcM"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/library/TextIconOverlay/1.2/src/TextIconOverlay_min.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/library/MarkerClusterer/1.2/src/MarkerClusterer_min.js"></script>
<script type="text/javascript">

//定义地图, 
var map = new BMap.Map("myMap"); // 创建Map实例
var centerPoint = new BMap.Point(121.485966, 31.239957); //初始化地图，中心点为上海中心点
map.centerAndZoom(centerPoint, 13); // 初始化地图,设置中心点坐标和地图级别
var opts = {             //设置左上角控件，地图缩放类型
	type : BMAP_NAVIGATION_CONTROL_SMALL
};
map.addControl(new BMap.NavigationControl(opts)); //添加左上角缩放控件 
map.enableScrollWheelZoom(); //可滚动缩放
map.disableDoubleClickZoom(); //关闭双击放大

var myGeo = new BMap.Geocoder();
var index = 0;
var list=${list};
document.getElementById("addressNum").value=list.length;
//var localSearch = new BMap.LocalSearch(map);
//localSearch.enableAutoViewport(); //允许自动调节窗体大小
var errorN=0;
var success=0;
//var keyword=null;
var markers = [];
var points = [];  // 添加海量点数据
	bdGEO();

function bdGEO(){
	var myIcon = new BMap.Icon("images/000_11.png", new BMap.Size(30,30));
	for(var i=0;i<list.length;i++)
	{

 		var address = new BMap.Point(list[i].addressLng, list[i].addressLat);
		/* addMarker(address,myIcon);  */
 		points.push(address);
	 	markers.push(new BMap.Marker(address)); 
		if(i==list.length-1){
			document.getElementById('load_address').style.display = "none";
		}
	}
	 if (document.createElement('canvas').getContext) {  // 判断当前浏览器是否支持绘制海量点
	        var options = {
	            size: BMAP_POINT_SIZE_SMALL,
	            shape: BMAP_POINT_SHAPE_STAR,
	            color: '#d340c3'
	        }
	        var pointCollection = new BMap.PointCollection(points, options);  // 初始化PointCollection
	        pointCollection.addEventListener('click', function (e) {
	          alert('单击点的坐标为：' + e.point.lng + ',' + e.point.lat);  // 监听点击事件
	        });
	        map.addOverlay(pointCollection);  // 添加Overlay
	    } else {
	        alert('请在chrome、safari、IE8+以上浏览器查看本示例');
	    } 
}
	

  //编写自定义函数,创建标注
function addMarker(point,label){
	var marker = new BMap.Marker(point,{icon:label});
	map.addOverlay(marker);
	//marker.setLabel(label);
}  


//编写自定义函数,创建标注
function juhe(){
	
	//var markerClusterer = new BMapLib.MarkerClusterer(map, {markers:markers});
	//map.addOverlay(marker);
	//marker.setLabel(label);
} 

	
</script>
</head>
<body>
<div id="JScharts_div"></div>

	<div id="outside_div">
		
		<form id="month_search" onsubmit="return navTabSearch(this);" action="mapForOrders.action?toResult=searchOrders&rightId=${rightId}" method="post">
			<div class="pageHeader">
				<input type="hidden" name="init" value=0>
				<div class="searchBar">
					<table class="searchContent">
						<tr>
						<td>开始时间: 
								   <input id="searchCompany_startTime" type="text" class="date" name="startTime" value="${startTime}"
									readonly="readonly" />
						</td>				

						<td>结束时间: <input id="searchCompany_endTime" type="text" class="date" name="endTime"  value="${endTime}"
									readonly="readonly" />
						</td>
						
<!-- 						<td>错误地址: <input disabled="disabled" id="errorNum" type="text" name="errorAddress" />
						</td> -->
	<!-- 					
						<td>查询地址数: <input disabled="disabled" id="successNum" type="text" name="success" />
						</td> -->
						<td>地质类型: 
						<select name="addressType" id="checkStatus_id">
						<option  value="0" <s:if test="#request.addressType==0">selected="selected"</s:if> >寄件人地址</option>
<!-- 						<option  value="1" <s:if test="#request.addressType==1">selected="selected"</s:if> >收件人地址</option> -->
						</select>
						</td>
							
						<td>地址总数: <input disabled="disabled" id="addressNum" type="text" name="errorAddress" />
						</td>
						<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
						<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
						<td>
								<div class="buttonActive">
									<div class="buttonContent">
										<button type="submit" >查询</button>
									</div>
								</div>
								<div class="buttonActive">
									<div class="buttonContent">
										<button type="button" onclick="juhe()">点聚合</button>
									</div>
								</div>
						</td>
					</tr>
			
				</table>
			</div>
		</div>
	</form>

		<div class="pageContent">			
				<div class="panelBar">
					<ul class="toolBar">

					</ul>
				</div>
		</div>		
			<div class="pageFormContent" layoutH="86">
						
						<div id="load_address" style="width:900px;height:30px;color:black;background:#77787b">
						Loading .....
						<br>
						查询地址中，请稍后！
						</div>
						<div id="myMap" style="width: 900px; height: 550px;">
									
						</div>
						
					
			</div>	
		</div>
</body>
</html>
